{% extends "base.html" %}

{% block head %}
	<link type="text/css" rel="stylesheet" href="stylesheets/main.css" />
{% endblock head %}

{% block nav %}
	<p>
		<a href="/view-pairs?category={{ category.key }}">View Cards</a>
		<a href="/new-pair?category={{ category.key }}">New Card</a>
	</p>
{% endblock nav %}

{% block content %}
	<p align="right">
		<a href="/view-pairs?category={{ category.key }}&page=next">next</a>
	</p>
	<table border="1">
		<tr>
			<td>Question</td>
			<td>Answer</td>
		</tr>
		{% for pair in pairs %}
		<tr>
			<td>{{ pair.question }}</td>
			<td>{{ pair.answer }}</td>
			<td><a href="/edit-pair?pair={{ pair.key }};category={{ category.key }}">Edit</a></td>
			<td><a href="/delete-pair?pair={{ pair.key }};category={{ category.key }}"
			   onclick="return confirm('Are you sure you want to delete this card?')">Delete</a></td>
			{% if not pair.reviewing %}
			<td><form action="/mark-review" method="post">
				<input type="hidden" name="pair" value="{{ pair.key }}" />
				<input type="hidden" name="category" value="{{ category.key }}" />
				<input type="submit" value="Add to Review Schedule" />
			</form></td>
			{% endif %}
		</tr>
		{% endfor %}
	</table>
	<p align="right">
		<a href="/view-pairs?category={{ category.key }}&page=next">next</a>
	</p>
{% endblock content %}
